import Vue from 'vue'
import store from './store'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/icons' // icon
import '@/assets/styles/index.scss' // index css

import '@/assets/styles/default.scss'
import '@/assets/styles/home.scss'
import '@/assets/styles/module.scss'
import '@/assets/styles/page.scss'
import '@/assets/styles/userMessage.scss'
import '@/assets/styles/iconfont.css'
import '@/assets/styles/forum.scss'

import App from './App'
import router from './router'
import './permission' // permission control
import {getObjectKeys,formatSolution,changeAvatar, vague, parseTime,change,handleTree,changeUrl,resetForm,addDateRange,getDay,addDateWeekRange } from '@/utils/association'
import Pagination from "@/components/Pagination";
import Breadcrumb from '@/components/Breadcrumb'

// 全局方法挂载
Vue.prototype.getObjectKeys = getObjectKeys
Vue.prototype.parseTime = parseTime
Vue.prototype.vague = vague
Vue.prototype.change = change
Vue.prototype.handleTree = handleTree
Vue.prototype.changeUrl = changeUrl
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.getDay = getDay
Vue.prototype.addDateWeekRange = addDateWeekRange
Vue.prototype.changeAvatar = changeAvatar
Vue.prototype.formatSolution = formatSolution

Vue.prototype.msgSuccess = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'success' })
}

Vue.prototype.msgError = function(msg) {
  this.$message({ showClose: true, message: msg, type: 'error' })
}

// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('Breadcrumb', Breadcrumb)
Vue.use(Element)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
